<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-label="关闭"><span aria-hidden="true">&times;</span></button>
  <h4 class="modal-title" id="classes-modal-label">已分配班级</h4>
</div>
<div class="modal-body editor-body-sm">
	<table data-ajax="handlerSearch" 
			 	 data-method="post" 
			 	 data-id-field="id" 
			 	 data-unique-id="id" 
			 	 data-pagination="true" 
			 	 data-check-on-init="true" 
			 	 data-click-to-select="true" 
			 	 data-side-pagination="server" 
			 	 data-mobile-responsive="true" 
			 	 data-form-search="#search-form-classes" id="table-classes-ready">
		<thead>
			<tr>
				<th data-checkbox="true"></th>
				<th data-field="id" data-visible="false"></th>
				<th data-field="classes" 		data-align="center">班级名称</th>
				<th data-field="teacher" 		data-align="center">负责老师</th>
				<th data-field="toplimit" 	data-align="center">学员上限</th>
				<th data-field="usecount" 	data-align="center">耗课数</th>
				<th data-field="operator" 	data-align="center" data-width="50" data-formatter="renderCancle">操作</th>
			</tr>
		</thead>
	</table>
</div>

<!-- 查询表单 ========================================================= -->
<form id="search-form-classes" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.eam.entity.view.StudentClasses">
			<input type="hidden" name="type" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="studentid" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>
<!-- 删除表单 ========================================================= -->
<form id="remove-form-classes" 		action="/miwawa/{dbname}/common/remove" method="post" name="com.app.miwawa.api.eam.entity.ClassesStudent"></form>
<form id="remove-form-leavelimit" action="/miwawa/{dbname}/common/remove" method="post" name="com.app.miwawa.api.eam.entity.StudentLeaveLimit"></form>

<script type="text/javascript">
<!--
	// 渲染已分配班级列表操作列
	function renderCancle(value, row, index){
		return "<a class='btn btn-danger btn-xs btn-table-op' onclick='deletedd(this, \""+row.id+"\",\""+row.leavelimitid+"\")' data-form-source='#remove-form-classes' data-table-source='#table-classes-ready' data-toggle='tooltip' data-placement='top' title='删除'> <i class='fa fa-trash'></i> </a>";
	}
	
	function deletedd(button, rowid, leavelimitid){
		var classesform = jQuery("#remove-form-classes");
		var leaveform = jQuery("#remove-form-leavelimit");
		jQuery.message.confirm("删除该记录后，所有相关数据将一并删除，并无法恢复，确定要删除该记录吗？",function(confirm){
			if(confirm){
				jQuery.ajaxsend({
					url:classesform.attr("action").replace("{dbname}", dbname),
					data:{
		 				entityClass:classesform.attr("name"),
		 				"bean":{
		 					"id":rowid
		 				}
		 			},
		 			success:function(data){
		 				if(!data.error) {
		 					jQuery.ajaxsend({
		 						url:leaveform.attr("action").replace("{dbname}", dbname),
		 						data:{
		 			 				entityClass:leaveform.attr("name"),
		 			 				"bean":{
		 			 					"id":leavelimitid
		 			 				}
		 			 			},
		 			 			success:function(){
		 			 				jQuery("#table-classes-ready").bootstrapTable("refresh");
		 			 			}
		 					});
		 				}else{
		 					jQuery.message.warning(data.error);
		 				}
		 			}
				});
			}
		});
	};
	
//-->
</script>